package com.faxsun.profile.core.service;

import java.util.List;

import org.broadleafcommerce.profile.core.domain.Customer;

import com.faxsun.profile.core.domain.FSCustomer;
import com.faxsun.profile.core.domain.FSThirdPartyCustomer;
import com.faxsun.profile.core.exception.AccountBindedThirdAccountException;
import com.faxsun.profile.core.exception.ThirdAccountBindToMultipleAccountException;
import com.faxsun.profile.core.exception.ThirdAccountBindedException;

public interface FSThirdPartyCustomerService {
	public FSThirdPartyCustomer create3thCustomerByUid(String uid);

	public FSThirdPartyCustomer getCustomer3thByUid(String uid);

	public FSThirdPartyCustomer save(FSThirdPartyCustomer fscustomer3th);

	public boolean checkCustomerBy3thUid(String uid);

	// return null if there is no customer, but should not null when uid was
	// existed.
	public FSCustomer getCustomerByUid(String uid);

	/**
	 * 绑定第三方帐户和用户名密码的用户
	 * 
	 * @param channelId
	 *            第三方渠道id
	 * @param uid
	 *            第三方帐户openId
	 * @param id
	 *            用户id
	 * @param password
	 *            用户输入的密码
	 * @param isPasswordLogin
	 *            是否已用密码登录
	 * @return
	 */
	public boolean bindAccount(String channelId, String uid, Long id, String password, boolean isPasswordLogin,String unionId,String avatar, String nickname)
			throws ThirdAccountBindedException, ThirdAccountBindToMultipleAccountException,
			AccountBindedThirdAccountException;

	public List<FSThirdPartyCustomer> readThirdPartyCustomerForCustomer(Customer customer);
	
	/**
	 * 将用户customerId，channelId的第三方账号解绑
	 * @param customerId
	 * @param channelId
	 */
	public void unbind(long customerId, String channelId);
	
	/**
	 * 根据Unionid查询第三方信息
	 * @param unionid
	 * @return
	 */
	public FSCustomer getCustomer3thByUnionid(String unionid);
	
	/**
	 * 检查unionid的第三方信息是否存在
	 * @param unionid
	 * @return
	 */
	public boolean checkCustomerBy3thUnionid(String unionid);

}
